package cn.blt.security.config;

import cn.blt.utils.MD5Utlis;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;

@Component
public class DefaultPasswordEncoder implements PasswordEncoder {

    @Override
    public String encode(CharSequence charSequence) {
        return MD5Utlis.encrypt((String) charSequence);
    }

    @Override
    public boolean matches(CharSequence charSequence, String password) {
        return password.equals(MD5Utlis.encrypt((String) charSequence));
    }
}
